﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Xqsys.DAL
{
    public class DatumType
    {
        /// <summary>
        /// 创建新的资料类型
        /// </summary>
        /// <param name="datumType"></param>
        /// <returns></returns>
        public bool AddDatumType(MODEL.DatumType datumType)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@Name",datumType.Name),
                new SqlParameter("@Introduction",datumType.Introduction)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_AddDatumType",param);
        }
        /// <summary>
        /// 提交资料类型
        /// </summary>
        /// <param name="datumType"></param>
        /// <returns></returns>
        public bool UpdateDatumType(MODEL.DatumType datumType)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@TypeID",datumType.TypeID),
                new SqlParameter("@name",datumType.Name),
                new SqlParameter("@Introduction",datumType.Introduction)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_UpdateDatumType", param);
        }
        /// <summary>
        /// 删除资料类型
        /// </summary>
        /// <param name="datumid"></param>
        /// <returns></returns>
        public bool DeleteDatumType(int datumid) 
        {
            SqlParameter[] parms = new SqlParameter[] 
            {
                new SqlParameter("@datumid",datumid)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_DeleteDatumType", parms);
        }
        /// <summary>
        /// 查找数据类型
        /// </summary>
        /// <param name="datumid"></param>
        /// <returns></returns>
        public DataSet SelectDatumType(int datumid)
        {
            SqlParameter[] parms = new SqlParameter[] 
            {
                new SqlParameter("@top",datumid)
            };
            return COM.SqlHelper.ExecuteQuery("sp_SelectDatumType", parms);
        }
    }
}
